<template>
	<view class="wp">
		<!-- <view class="kalist">
			<view class="span">会员名</view>
			<view class="em">张三</view>
		</view> -->
		
		<!-- <view class="kalist">
			<view class="span">会员手机号</view>
			<view class="em">张三</view>
		</view> -->
		
		<view class="web_out_con">
			<view class="span">会员手机号或身份证号</view>
			<view class="fill">
				<input style="font-size: 16px;" v-model="key" type="text" placeholder="请输入会员手机号或身份证号">
			</view>
		</view>
		
		<view class="web_out_con">
			<view class="span">本次使用积分</view>
			<view class="fill">
				<input style="font-size: 16px;" v-model="integral" type="number" placeholder="请输入本次使用积分">
			</view>
			<div class="btn" @click="Sub()">确定</div>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				key:'',
				integral:'',
			}
		},
		onLoad() {
			let that = this;

		},
		methods: {
			Sub:function(){
				let that= this;
				if (that.key == '') {
					uni.showToast({
						icon: 'none',
						title: '请输入会员手机号或身份证号',
						duration: 2000
					});
				}
				else if (that.integral == '') {
					uni.showToast({
						icon: 'none',
						title: '请输入本次使用积分',
						duration: 2000
					});
				}
				else{
					uni.showLoading({
						title: '提交中...',
						mask: true
					});
					let _data = {
						key:that.key,
						integral:that.integral
					}
					that.common.http('POST', 'user/exchange', _data, function(res) {
						uni.hideLoading();
						uni.showToast({
							icon: 'none',
							title: '积分核销成功',
							duration: 2000,
							mask:true
						});
						setTimeout(function() {
							that.navigateBack();
						}, 1500);
					});
				}
			},
		}
	}
</script>

<style scoped>
	.wp {
		background-color: #fff;
		padding-bottom: 40rpx;
	}

	.kalist {
		height: 100rpx;
		align-items: center;
		line-height: 1;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #ebebeb;
	}

	.kalist .span {
		font-size: 32rpx;
		color: #000;
	}

	.kalist .em {
		font-size: 28rpx;
		color: #444;
	}
	.web_out_con .fill{padding-left: 0rpx;font-size: 22rpx;}
</style>